# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Geoffroy Carrier <geoffroy.carrier@koon.fr>
# Contributor: congyiwu <congyiwu AT gmail DOT com>

pkgname=json-c
pkgver=0.13.1
pkgrel=2
pkgdesc="A JSON implementation in C"
url="https://github.com/json-c/json-c/wiki"
license=(MIT)
arch=(x86_64)
depends=(glibc)
makedepends=(git)
_commit=985c46fec39d1d3043f98e8d8cdb9d040131b3bb  # tags/json-c-0.13.1-20180305^0
source=("git+https://github.com/json-c/json-c#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd json-c
  local tag="$(git describe --tags --abbrev=0)"
  local ver="$(git describe --tags)"
  echo "${tag%-*}${ver#$tag}" | sed 's/^json-c-//;s/-/+/g'
}

prepare() {
  cd json-c
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd json-c
  ./configure \
    --prefix=/usr \
    --disable-static \
    --enable-threading
  make
}

check() {
  cd json-c
  make check
}

package() {
  cd json-c
  make DESTDIR="$pkgdir" install
  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 COPYING
}

# vim:set sw=2 et:
